package com.qiuguo.rtsp.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import static com.qiuguo.rtsp.service.StreamService.OUTPUT_DIR;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/hls/**")
                .addResourceLocations("file:" + OUTPUT_DIR + "/");
        
        // 添加对静态管理页面的支持
        registry.addResourceHandler("/*.html")
                .addResourceLocations("classpath:/static/");
    }
}